#pragma once
#include<iostream>
using namespace std;
class Mutex
{
public:
    Mutex(pthread_mutex_t* mutex = nullptr):_lock(mutex)
    {}
    void Lock()
    {
        pthread_mutex_lock(_lock);
    }
    void unLock()
    {
        pthread_mutex_unlock(_lock);
    }
    ~Mutex()
    {}

private:
    pthread_mutex_t *_lock;
};


class LockGuard
{
public:
    LockGuard(pthread_mutex_t* lock):_lock(lock)
    {
        _lock.Lock();
    }
    ~LockGuard()
    {
        _lock.unLock();
    }
private:
    Mutex _lock;
};